home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / xms206.arc / CLIB.ARC / CMACROS.INC next >
Text File  |  1989-04-04  |  17KB  |  1,235 lines

  1. comment $
  2. cmacros - assembly macros for interfacing to hhls
  3. (C)Copyright Microsoft Corp. 1984-1987
  4. $
  5. .xcref
  6. .xcref ??_out
  7. ??_out macro t
  8. ifndef ?QUIET
  9. %out t
  10. endif
  11. endm
  12. outif macro name,defval,onmsg,offmsg
  13. ifndef name
  14. ifb <defval>
  15. name=0
  16. else
  17. name=defval
  18. endif
  19. endif
  20. if name
  21. name=1
  22. ifnb <onmsg>
  23. ??_out <! onmsg>
  24. endif
  25. else
  26. ifnb <offmsg>
  27. ??_out <! offmsg>
  28. endif
  29. endif
  30. endm
  31. .xcref ??error
  32. ??error macro msg
  33. e r r o r ----- msg
  34. .err
  35. endm
  36. .xcref ASMpass
  37. .xcref memS,memM,memL,memC,memH,memMOD,sizec,sized
  38. if1
  39. ASMpass=1
  40. ifdef ?SMALL
  41. memS=1
  42. endif
  43. ifdef ?MEDIUM
  44. memM=1
  45. endif
  46. ifdef ?COMPACT
  47. memC=1
  48. endif
  49. ifdef ?LARGE
  50. memL=1
  51. endif
  52. ifdef ?HUGE
  53. memH=1
  54. endif
  55. ??_out <cMacros Version 5.00 - 01/26/88>
  56. ??_out <Copyright (C) Microsoft Corp. 1984-1988. All rights reserved.>
  57. outif memS,0,<Small Model>
  58. outif memM,0,<Medium model>
  59. outif memL,0,<Large Model>
  60. outif memC,0,<Compact Model>
  61. outif memH,0,<Huge Model>
  62. memMOD= memS + memM + memL + memC + memH
  63. if memMOD ne 1
  64. if memMOD eq 0
  65. memS = 1
  66. outif memS,0,<Small model>
  67. else
  68. ??error <must have only 1 memory model selected>
  69. endif
  70. endif
  71. sizec= memM + memL + memH
  72. sized= memL + memC + (memH*2)
  73. outif ?DF,0,<No segments or groups will be defined>
  74. outif ?TF,0,<Epilog sequences assume valid SP>
  75. outif ?WIN,1,<Windows support>
  76. outif ?PLM,1,<PL/M calling convention>
  77. ifndef ?NODATA
  78. ?nodata1=0
  79. else
  80. ?nodata1=1
  81. ??_out <! NODATA module>
  82. endif
  83. ifndef ?CHKSTK
  84. ?chkstk1=0
  85. else
  86. ?chkstk1=1
  87. ifdef ?CHKSTKPROC
  88. ??_out <! Private stack checking enabled>
  89. else
  90. ??_out <! Stack checking enabled>
  91. endif
  92. endif
  93. ifndef DOS5
  94. ?DOS5=0
  95. else
  96. ?DOS5=1
  97. ??_out <! DOS5 module>
  98. endif
  99. ifdef ?PROFILE
  100. ??_out <! Native profiling enabled>
  101. endif
  102. else
  103. ASMpass=2
  104. endif
  105. .xcref ?n,?ax,?ah,?al,?bx,?bh
  106. .xcref ?bl,?cx,?ch,?cl,?dx,?dh
  107. .xcref ?dl,?si,?di,?es,?ds,?bp
  108. .xcref ?sp,?ss,?cs
  109. .xcref ?rsl,?cpd,?argl,?argc,?ba
  110. .xcref ?acb,???,?po
  111. .xcref ?pas,?pc
  112. .xcref uconcat,mpush,mpop
  113. .xcref ?ri,?pp,?pp1,?al1
  114. .xcref ?ad,?ap,?atal,?dd,?dd1,?dd2
  115. .xcref ?pg,?pg1,?aloc,?cs1,?cs2
  116. .xcref ?DF,?TF,?ff,?PLM,?WIN,?ia,?pu,?adj
  117. .xcref ?uf,?rp,?nx,?nd,?nodata1,?chkstk1,?DOS5
  118. .xcref ?wfp,arg,cCall,cProc,assumes,?cs3,?cs2,?cs1
  119. .xcref defgrp,addseg,createSeg
  120. .xcref save,outif,errnz,errn$,errnz1
  121. .xcref ?PLMPrevParm,?gcc
  122. .xcref ?cCall1,?pcc
  123. ?rsl = 0
  124. ?cpd = 0
  125. ?argl = 0
  126. ?argc = 0
  127. ?ba = 0
  128. ?acb = 0
  129. ??? = 0
  130. ?po = 0
  131. ?pas = 0
  132. ?pc = 0
  133. ?ia = 0
  134. ?pu = 0
  135. ?adj = 0
  136. ?rp = 0
  137. ?uf = 0
  138. ?nd = 0
  139. ?nx = 0
  140. ?wfp = 0
  141. ?ff = 0
  142. ?dd2 = 0
  143. ?cCall1 = 0
  144. ?pcc = 0
  145. ?PLMPrevParm = 0
  146. .xcref ?casen
  147. if1
  148. ?casen = 0
  149. endif
  150. ?n = 0000000000000000b
  151. ?ax = 0000000000000011b
  152. ?ah = 0000000000000001b
  153. ?al = 0000000000000010b
  154. ?bx = 0000000000001100b
  155. ?bh = 0000000000000100b
  156. ?bl = 0000000000001000b
  157. ?cx = 0000000000110000b
  158. ?ch = 0000000000010000b
  159. ?cl = 0000000000100000b
  160. ?dx = 0000000011000000b
  161. ?dh = 0000000001000000b
  162. ?dl = 0000000010000000b
  163. ?si = 0000000100000000b
  164. ?di = 0000001000000000b
  165. ?es = 0000010000000000b
  166. ?ds = 0000100000000000b
  167. ?bp = 0001000000000000b
  168. ?sp = 0010000000000000b
  169. ?ss = 0100000000000000b
  170. ?cs = 1000000000000000b
  171. .cref
  172. uconcat macro a,b,c,d,e,f,g
  173. a&b c&d e&f&g
  174. endm
  175. mpush macro r
  176. irp x,<ax,bx,cx,dx,si,di,es,ds,bp,sp,ss,cs>
  177. if (r and ?&&x)
  178.     push    x
  179. endif
  180. endm
  181. endm
  182. mpop macro r
  183. irp x,<cs,ss,sp,bp,ds,es,di,si,dx,cx,bx,ax>
  184. if (r and ?&&x)
  185.     pop    x
  186. endif
  187. endm
  188. endm
  189. save macro r
  190. ?rsl=0
  191. ?ri ?rsl,<r>
  192. endm
  193. ?ri macro n,r
  194. irp x,<r>
  195. ifdef ?&&x
  196. n=n or ?&&x
  197. endif
  198. endm
  199. endm
  200. .xcref
  201. .xcref parmB,parmW,parmD,parmQ,parmT,parmCP,parmDP
  202. .cref
  203. parmB macro n
  204. ?pp <n>,<byte>,2,1
  205. endm
  206. parmW macro n
  207. ?pp <n>,<word>,2,2
  208. endm
  209. parmD macro n
  210. ife ?PLM
  211. irp x,<n>
  212. ?pp <&&x>,<dword>,0,4
  213. ?pp <off_&&x>,<word>,2,2
  214. ?pp <seg_&&x>,<word>,2,2
  215. endm
  216. else
  217. irp x,<n>
  218. ?pp <seg_&&x>,<word>,2,2
  219. ?pp <off_&&x>,<word>,2,2
  220. ?pp <&&x>,<dword>,0,4
  221. endm
  222. endif
  223. endm
  224. parmQ macro n
  225. ?pp <n>,<qword>,8,8
  226. endm
  227. parmT macro n
  228. ?pp <n>,<tbyte>,10,10
  229. endm
  230. if sizec
  231. parmCP macro n
  232. parmD <n>
  233. endm
  234. else
  235. parmCP macro n
  236. parmW <n>
  237. endm
  238. endif
  239. if sized
  240. parmDP macro n
  241. parmD <n>
  242. endm
  243. else
  244. parmDP macro n
  245. parmW <n>
  246. endm
  247. endif
  248. ?pp macro n,t,l,s
  249. if ?cpd
  250. .xcref
  251. irp x,<n>
  252. .xcref ?t&&x
  253. ?t&&x=s
  254. ife ?PLM
  255. ?pp1 x,<t>,,,%(?po+?adj)
  256. ?po=?po+l
  257. else
  258. ?PLMPrevParm=?PLMPrevParm+1
  259. ?po=?po+l
  260. ?pp1 x,<t>,%?po,%?adj,,%?PLMPrevParm,%(?PLMPrevParm-1)
  261. endif
  262. endm
  263. .cref
  264. else
  265. ??error <parm(s) "&n" declared outside proc def>
  266. endif
  267. endm
  268. ?pp1 macro n,t,o,a,b,cpc,ppc
  269. ife ?PLM
  270. n equ (t ptr [bp+b])
  271. else
  272. .xcref
  273. .xcref ?PLMParm&cpc
  274. .cref
  275. ?PLMParm&cpc ¯o po
  276. uconcat <n>,,<equ>,,<(t ptr [bp+>,%(a+po-o),<])>
  277. ?PLMParm&ppc po
  278. purge ?PLMParm&cpc
  279. &endm
  280. endif
  281. endm
  282. ifndef ?NOPARMR
  283. .xcref
  284. .xcref ?pr,parmR
  285. .cref
  286. parmR macro n,r,r2
  287. ?pr n,r,r2,%?rp,%(?ia+2)
  288. endm
  289. ?pr macro n,r,r2,i,o
  290. .xcref
  291. ifnb <r2>
  292. parmR seg_&n,r
  293. parmR off_&n,r2
  294. n equ (dword ptr [bp-o-2])
  295. .xcref ?t&n
  296. ?t&n=4
  297. else
  298. .xcref ?rp&i
  299. ?rp&i=0
  300. ifdef ?&r
  301. ?rp&i=?&r
  302. endif
  303. if ??? or (?cpd eq 0) or (?rp&i eq 0)
  304. ??error <invalid parmR encountered: &n,&r>
  305. exitm
  306. endif
  307. n equ (word ptr [bp-o])
  308. ?t&n=2
  309. irp x,<bh,ch,dh,bl,cl,dl,ah,al>
  310. if ?&&x eq ?&r
  311. n equ (byte ptr [bp-o])
  312. ?t&n=1
  313. exitm
  314. endif
  315. endm
  316. ?ia=?ia+2
  317. ?rp=?rp+1
  318. endif
  319. .cref
  320. endm
  321. endif
  322. .xcref
  323. .xcref localB,localW,localD,localQ,localT,localCP,localDP,localV
  324. .cref
  325. localB macro n
  326. ?aloc <n>,<byte ptr>,1,1,0
  327. endm
  328. localW macro n
  329. ?aloc <n>,<word ptr>,2,2,1
  330. endm
  331. localD macro n
  332. irp x,<n>
  333. ?aloc <seg_&&x>,<word ptr>,2,2,1
  334. ?aloc <off_&&x>,<word ptr>,2,2,1
  335. ?aloc <&&x>,<dword ptr>,0,4,1
  336. endm
  337. endm
  338. localQ macro n
  339. ?aloc <n>,<qword ptr>,8,8,1
  340. endm
  341. localT macro n
  342. ?aloc <n>,<tbyte ptr>,10,10,1
  343. endm
  344. if sizec
  345. localCP macro n
  346. localD <n>
  347. endm
  348. else
  349. localCP macro n
  350. localW <n>
  351. endm
  352. endif
  353. if sized
  354. localDP macro n
  355. localD <n>
  356. endm
  357. else
  358. localDP macro n
  359. localW <n>
  360. endm
  361. endif
  362. localV macro n,a
  363. ?aloc <n>,,%(a),0,1
  364. endm
  365. ?aloc macro n,t,l,s,a
  366. if ?cpd
  367. .xcref
  368. irp x,<n>
  369. ???=???+l
  370. if a
  371. ???=((??? + 1) and 0fffeh)
  372. endif
  373. ?al1 x,<t>,%(???+?ia)
  374. .xcref ?t&&x
  375. ?t&&x=s
  376. endm
  377. .cref
  378. else
  379. ??error <locals "&n" declared outside procedure def>
  380. endif
  381. endm
  382. ?al1 macro n,t,o
  383. n equ (t [bp-o])
  384. endm
  385. ?gcc macro s,i,cc
  386. s = i
  387. ifnb <cc>
  388. ifidn <cc>,<C>
  389. s=0
  390. endif
  391. ifidn <cc>,<PLM>
  392. s=1
  393. endif
  394. ifidn <cc>,<PASCAL>
  395. s=1
  396. endif
  397. endif
  398. endm
  399. ifndef ?NOGLOBAL
  400. .xcref
  401. .xcref globalB,globalW,globalD,globalQ,globalT,globalCP,globalDP
  402. .cref
  403. globalB macro n,i,s,c
  404. ?ad <n>,1
  405. ?dd n,1,<byte>,<db>,<i>,<s>,<c>
  406. endm
  407. globalW macro n,i,s,c
  408. ?ad <n>,2
  409. ?dd n,1,<word>,<dw>,<i>,<s>,<c>
  410. endm
  411. globalD macro n,i,s,c
  412. ?ad <n>,4
  413. ?dd n,1,<dword>,<dd>,<i>,<s>,<c>
  414. off_&n equ n
  415. seg_&n equ n[2]
  416. endm
  417. globalQ macro n,i,s,c
  418. ?ad <n>,8
  419. ?dd n,1,<qword>,<dq>,<i>,<s>,<c>
  420. endm
  421. globalT macro n,i,s,c
  422. ?ad <n>,10
  423. ?dd n,1,<tbyte>,<dt>,<i>,<s>,<c>
  424. endm
  425. if sizec
  426. globalCP macro n,i,s,c
  427. globalD n,<i>,<s>,<c>
  428. endm
  429. else
  430. globalCP macro n,i,s,c
  431. globalW n,<i>,<s>,<c>
  432. endm
  433. endif
  434. if sized
  435. globalDP macro n,i,s,c
  436. globalD n,<i>,<s>,<c>
  437. endm
  438. else
  439. globalDP macro n,i,s,c
  440. globalW n,<i>,<s>,<c>
  441. endm
  442. endif
  443. endif
  444. ifndef ?NOSTATIC
  445. .xcref
  446. .xcref staticB,staticW,staticD,staticQ,staticT,staticCP,staticDP
  447. .cref
  448. staticB macro n,i,s
  449. ?ad <n>,1
  450. ?dd n,0,<byte>,<db>,<i>,<s>,<PLM>
  451. endm
  452. staticW macro n,i,s
  453. ?ad <n>,2
  454. ?dd n,0,<word>,<dw>,<i>,<s>,<PLM>
  455. endm
  456. staticD macro n,i,s
  457. ?ad <n>,4
  458. ?dd n,0,<dword>,<dd>,<i>,<s>,<PLM>
  459. endm
  460. staticQ macro n,i,s
  461. ?ad <n>,8
  462. ?dd n,0,<qword>,<dq>,<i>,<s>,<PLM>
  463. endm
  464. staticT macro n,i,s
  465. ?ad <n>,10
  466. ?dd n,0,<tbyte>,<dt>,<i>,<s>,<PLM>
  467. endm
  468. if sizec
  469. staticCP macro n,i,s
  470. staticD n,<i>,<s>
  471. endm
  472. else
  473. staticCP macro n,i,s
  474. staticW n,<i>,<s>
  475. endm
  476. endif
  477. if sized
  478. staticDP macro n,i,s
  479. staticD n,<i>,<s>
  480. endm
  481. else
  482. staticDP macro n,i,s
  483. staticW n,<i>,<s>
  484. endm
  485. endif
  486. endif
  487. ?dd macro n,p,t,d,i,s,c
  488. ?gcc ?dd2,%?PLM,<c>
  489. ife ?dd2
  490. n label t
  491. ?dd1 _&n,p,<d>,<i>,<s>
  492. else
  493. ?dd1 n,p,<d>,<i>,<s>
  494. endif
  495. endm
  496. ?dd1 macro n,p,d,i,s
  497. if p
  498. public n
  499. endif
  500. ifb <s>
  501. n d i
  502. else
  503. ifb <i>
  504. n d s dup (?)
  505. else
  506. n d s dup (i)
  507. endif
  508. endif
  509. endm
  510. ifndef ?NOEXTERN
  511. .xcref
  512. .xcref ?ex1,?ex2,externB,externW,externD,externQ,externT
  513. .xcref externNP,externFP,externP,externCP,externDP,externA
  514. .cref
  515. ?ex2 = 0
  516. externA macro n,c
  517. ?ex1 <n>,40h,<abs>,<c>,<>
  518. endm
  519. externB macro n,c
  520. ?ex1 <n>,1,<byte>,<c>,<>
  521. endm
  522. externW macro n,c
  523. ?ex1 <n>,2,<word>,<c>,<>
  524. endm
  525. externD macro n,c
  526. ?ex1 <n>,4,<dword>,<c>,<>
  527. endm
  528. externQ macro n,c
  529. ?ex1 <n>,8,<qword>,<c>,<>
  530. endm
  531. externT macro n,c
  532. ?ex1 <n>,10,<tbyte>,<c>,<>
  533. endm
  534. externNP macro n,c
  535. ?ex1 <n>,2,<near>,<c>,<cc>
  536. endm
  537. externFP macro n,c
  538. ?ex1 <n>,4,<far>,<c>,<cc>
  539. endm
  540. if sizec
  541. externP macro n,c
  542. ?ex1 <n>,4,<far>,<c>,<cc>
  543. endm
  544. else
  545. externP macro n,c
  546. ?ex1 <n>,2,<near>,<c>,<cc>
  547. endm
  548. endif
  549. if sizec
  550. externCP macro n,c
  551. ?ex1 <n>,4,<dword>,<c>,<>
  552. endm
  553. else
  554. externCP macro n,c
  555. ?ex1 <n>,2,<word>,<c>,<>
  556. endm
  557. endif
  558. if sized
  559. externDP macro n,c
  560. ?ex1 <n>,4,<dword>,<c>,<>
  561. endm
  562. else
  563. externDP macro n,c
  564. ?ex1 <n>,2,<word>,<c>,<>
  565. endm
  566. endif
  567. ?ex1 macro n,s,d,c,scv
  568. ?gcc ?ex2,%?PLM,<c>
  569. irp x,<n>
  570. .xcref
  571. .xcref ?t&&x
  572. .cref
  573. ?t&&x=s
  574. ife ?ex2
  575. extrn _&&x:&d
  576. x equ _&&x
  577. else
  578. extrn x:&d
  579. endif
  580. ifidn <scv>,<cc>
  581. .xcref
  582. .xcref ?CC&&x
  583. .cref
  584. ?CC&&x=?ex2
  585. endif
  586. endm
  587. endm
  588. endif
  589. ifndef ?NOLABEL
  590. .xcref
  591. .xcref ?lb1,?lblpu,?lb2
  592. .xcref labelB,labelW,labelD,labelQ,labelT
  593. .xcref labelNP,labelFP,labelP,labelCP,labelDP
  594. .cref
  595. ?lblpu = 0
  596. ?lb2 = 0
  597. labelB macro n,c
  598. ?lb1 <n>,1,<byte>,<c>
  599. endm
  600. labelW macro n,c
  601. ?lb1 <n>,2,<word>,<c>
  602. endm
  603. labelD macro n,c
  604. ?lb1 <n>,4,<dword>,<c>
  605. endm
  606. labelQ macro n,c
  607. ?lb1 <n>,8,<qword>,<c>
  608. endm
  609. labelT macro n,c
  610. ?lb1 <n>,10,<tbyte>,<c>
  611. endm
  612. labelNP macro n,c
  613. ?lb1 <n>,2,<near>,<c>
  614. endm
  615. labelFP macro n,c
  616. ?lb1 <n>,4,<far>,<c>
  617. endm
  618. if sizec
  619. labelP macro n,c
  620. ?lb1 <n>,4,<far>,<c>
  621. endm
  622. else
  623. labelP macro n,c
  624. ?lb1 <n>,2,<near>,<c>
  625. endm
  626. endif
  627. if sizec
  628. labelCP macro n,c
  629. ?lb1 <n>,4,<dword>,<c>
  630. endm
  631. else
  632. labelCP macro n,c
  633. ?lb1 <n>,2,<word>,<c>
  634. endm
  635. endif
  636. if sized
  637. labelDP macro n,c
  638. ?lb1 <n>,4,<dword>,<c>
  639. endm
  640. else
  641. labelDP macro n,c
  642. ?lb1 <n>,2,<word>,<c>
  643. endm
  644. endif
  645. ?lb1 macro n,s,d,c
  646. ?gcc ?lb2,%?PLM,<c>
  647. ?lblpu=0
  648. irp x,<n>
  649. ifidn <x>,<PUBLIC>
  650. ?lblpu=1
  651. else
  652. .xcref
  653. .xcref ?t&&x
  654. .cref
  655. ?t&&x=s
  656. ife ?lb2
  657. if ?lblpu
  658. public _&&x
  659. endif
  660. _&&x label &d
  661. x equ _&&x
  662. else
  663. if ?lblpu
  664. public x
  665. endif
  666. x label &d
  667. endif
  668. endif
  669. endm
  670. endm
  671. endif
  672. ifndef ?NODEF
  673. .xcref
  674. .xcref defB,defW,defD,defQ,defT,defCP,defDP
  675. .cref
  676. defB macro n
  677. ?ad <n>,1
  678. endm
  679. defW macro n
  680. ?ad <n>,2
  681. endm
  682. defD macro n
  683. ?ad <n>,4
  684. endm
  685. defQ macro n
  686. ?ad <n>,8
  687. endm
  688. defT macro n
  689. ?ad <n>,10
  690. endm
  691. if sizec
  692. defCP macro n
  693. defD <n>
  694. endm
  695. else
  696. defCP macro n
  697. defW <n>
  698. endm
  699. endif
  700. if sized
  701. defDP macro n
  702. defD <n>
  703. endm
  704. else
  705. defDP macro n
  706. defW <n>
  707. endm
  708. endif
  709. endif
  710. ?ad macro n,s
  711. irp x,<n>
  712. .xcref
  713. .xcref ?t&&x
  714. .cref
  715. ?t&&x=s
  716. endm
  717. endm
  718. ifndef ?NOPTR
  719. .xcref
  720. .xcref regPtr,farPtr
  721. .cref
  722. regPtr macro n,s,o
  723. farPtr n,s,o
  724. endm
  725. farPtr macro n,s,o
  726. .xcref
  727. .xcref ?t&n
  728. .cref
  729. n ¯o
  730.     push    s
  731.     push    o
  732. &endm
  733. ?t&n=80h
  734. endm
  735. endif
  736. arg macro a
  737. irp x,<a>
  738. ?argc=?argc+1
  739. ?atal <x>,%?argc
  740. endm
  741. endm
  742. ?atal macro n,i
  743. .xcref
  744. .xcref ?ali&i
  745. .cref
  746. ?ali&i ¯o
  747. ?ap n
  748. &endm
  749. endm
  750. ?ap macro n
  751. ?argl=?argl+2
  752. ifdef ?t&n
  753. ife ?t&n-1
  754.     push    word ptr (n)
  755. exitm
  756. endif
  757. ife ?t&n-2
  758.     push    n
  759. exitm
  760. endif
  761. ife ?t&n-4
  762.     push    word ptr (n)[2]
  763.     push    word ptr (n)
  764. ?argl=?argl+2
  765. exitm
  766. endif
  767. ife ?t&n-8
  768.     push    word ptr (n)[6]
  769.     push    word ptr (n)[4]
  770.     push    word ptr (n)[2]
  771.     push    word ptr (n)
  772. ?argl=?argl+6
  773. exitm
  774. endif
  775. if ?t&n and 80h
  776. n
  777. ?argl=?argl+2
  778. exitm
  779. endif
  780. ife ?t&n
  781.     push    word ptr (n)
  782. exitm
  783. endif
  784. endif
  785.     push    n
  786. endm
  787. cCall macro n,a,c
  788. ifnb <a>
  789. arg <a>
  790. endif
  791. mpush %?rsl
  792. ifdef ?CC&n
  793. ?cCall1=?CC&n
  794. else
  795. ?cCall1=?PLM
  796. endif
  797. ifnb <c>
  798. ?gcc ?cCall1,%?cCall1,<c>
  799. endif
  800. ?argl=0
  801. ife ?cCall1
  802. ?acb=?argc
  803. else
  804. ?acb=1
  805. endif
  806. rept ?argc
  807. uconcat <?ali>,%?acb
  808. uconcat <purge>,,<?ali>,%?acb
  809. ife ?cCall1
  810. ?acb=?acb-1
  811. else
  812. ?acb=?acb+1
  813. endif
  814. endm
  815.     call    n
  816. if ((?cCall1 eq 0) and (?argl ne 0))
  817.     add    sp,?argl
  818. endif
  819. mpop %?rsl
  820. ?rsl=0
  821. ?argc= 0
  822. ?argl= 0
  823. endm
  824. cProc macro n,cf,a
  825. if ?cpd
  826. ?utpe
  827. endif
  828. ?cpd=1
  829. ???=0
  830. ?argc=0
  831. ?ba=0
  832. ?po=0
  833. ?pu=0
  834. ?ia=0
  835. ?adj=4
  836. ?rp=0
  837. ?uf=0
  838. ?wfp=?WIN
  839. ?ff=0
  840. ?pas=0
  841. ?pcc=?PLM
  842. ifnb <a>
  843. ?ri ?pas,<a>
  844. endif
  845. ?pc=sizec
  846. ?nd=?nodata1
  847. ?nx=0
  848. irp x,<cf>
  849. ifidn <x>,<FAR>
  850. ?pc=1
  851. endif
  852. ifidn <x>,<NEAR>
  853. ?pc=0
  854. endif
  855. ifidn <x>,<PUBLIC>
  856. ?pu=1
  857. endif
  858. ifidn <x>,<SMALL>
  859. ?uf=1
  860. endif
  861. ifidn <x>,<DATA>
  862. ?nd=0
  863. endif
  864. ifidn <x>,<NODATA>
  865. ?nd=1
  866. endif
  867. ifidn <x>,<ATOMIC>
  868. ?nx=1
  869. endif
  870. ifidn <x>,<C>
  871. ?pcc=0
  872. endif
  873. ifidn <x>,<PLM>
  874. ?pcc=1
  875. endif
  876. ifidn <x>,<PASCAL>
  877. ?pcc=1
  878. endif
  879. ifidn <x>,<WIN>
  880. ?wfp=1
  881. endif
  882. ifidn <x>,<NONWIN>
  883. ?wfp=0
  884. endif
  885. endm
  886. if ?pcc
  887. ?PLMPrevParm=0
  888. .xcref
  889. .xcref ?PLMParm0
  890. .cref
  891. ?PLMParm0 ¯o
  892. purge ?PLMParm0
  893. &endm
  894. endif
  895. .xcref
  896. .xcref ?CC&n
  897. .cref
  898. ?CC&n=?pcc
  899. if (?nx eq 1) and (?nd eq 0)
  900. ?nx = 0
  901. ??error <ATOMIC specified without NODATA - ATOMIC ignored>
  902. endif
  903. if ?pc
  904. if ?wfp
  905. ife ?nx
  906. ?ia=2
  907. ?pas = ?pas and (not ?ds)
  908. endif
  909. endif
  910. ?adj=?adj+2
  911. else
  912. ?wfp=0
  913. endif
  914. ?pas = ?pas and (not (?sp+?cs+?ss))
  915. if ?uf
  916. ?pas = ?pas and (not (?bp+?si+?di))
  917. endif
  918. ife ?pcc
  919. ?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  920. else
  921. ?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
  922. endif
  923. endm
  924. ?pg macro n,p,c,a,w,nnu,cc
  925. .xcref
  926. if ?uf
  927. if ?nd
  928. ??error <NODATA encountered in &n - user frame ignored>
  929. ?uf=0
  930. endif
  931. endif
  932. .xcref cBegin
  933. cBegin ¯o g
  934. .xcref
  935. if cc
  936. uconcat <?PLMParm>,%?PLMPrevParm,%?po
  937. endif
  938. if ?uf
  939. if ?rp
  940. ??error <parmR encountered in &n - user frame ignored>
  941. ?uf=0
  942. endif
  943. endif
  944. ?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc
  945. ?cpd=0
  946. ?argc=0
  947. ?ba=1
  948. ???=(???+1) and 0fffeh
  949. if p
  950. public n
  951. endif
  952. ife c
  953. n proc near
  954. else
  955. n proc far
  956. endif
  957. ife cc
  958. nnu equ n
  959. endif
  960. ifidn <g>,<nogen>
  961. if ???+?po+a+?rp
  962. ??_out <cBegin - possible invalid use of nogen>
  963. endif
  964. else
  965. if ?uf
  966. ?mf c,%???,%?po
  967. mpush a
  968. else
  969. if w
  970. ife ?nd
  971.     mov    ax,ds
  972.     nop
  973. endif
  974. ife ?nx
  975. ife ?DOS5
  976.     inc    bp
  977. endif
  978.     push    bp
  979.     mov    bp,sp
  980.     push    ds
  981. else
  982. if ?ff+???+?po+?rp
  983.     push    bp
  984.     mov    bp,sp
  985. endif
  986. endif
  987. ife ?nd
  988.     mov    ds,ax
  989. endif
  990. else
  991. if ?ff+???+?po+?rp
  992.     push    bp
  993.     mov    bp,sp
  994. endif
  995. endif
  996. if ?rp
  997. ?uf=0
  998. rept ?rp
  999. uconcat mpush,,?rp,%?uf
  1000. ?uf=?uf+1
  1001. endm
  1002. endif
  1003. if ???
  1004. if ?chkstk1
  1005. ifdef ?CHKSTKPROC
  1006. ?CHKSTKPROC %???
  1007. else
  1008.     mov    ax,???
  1009. ife cc
  1010.     call    _chkstk
  1011. else
  1012.     call    chkstk
  1013. endif
  1014. endif
  1015. else
  1016.     sub    sp,???
  1017. endif
  1018. endif
  1019. mpush a
  1020. endif
  1021. ifdef ?PROFILE
  1022. if c
  1023.     call    StartNMeas
  1024. endif
  1025. endif
  1026. endif
  1027. .cref
  1028. purge cBegin
  1029. &endm
  1030. .xcref ?utpe
  1031. ?utpe ¯o
  1032. ??error <unterminated procedure definition: "&n">
  1033. &endm
  1034. .cref
  1035. endm
  1036. ?pg1 macro n,c,a,o,w,f,d,r,cc
  1037. .xcref
  1038. .xcref cEnd
  1039. cEnd ¯o g
  1040. .xcref
  1041. ?ba=0
  1042. ifidn <g>,<nogen>
  1043. if o+a+r
  1044. ??_out <cEnd - possible invalid use of nogen>
  1045. endif
  1046. else
  1047. ifdef ?PROFILE
  1048. if c
  1049. call StopNMeas
  1050. endif
  1051. endif
  1052. mpop a
  1053. if f
  1054.     db    0c3h
  1055. else
  1056. if w
  1057. ife ?nx
  1058. if (?TF eq 0) or (???+?rp)
  1059.     lea    sp,-2[bp]
  1060. endif
  1061.     pop    ds
  1062.     pop    bp
  1063. ife ?DOS5
  1064.     dec    bp
  1065. endif
  1066. else
  1067. if (?TF eq 0) or (???+?rp)
  1068.     mov    sp,bp
  1069. endif
  1070. if ???+?po+?rp
  1071.     pop    bp
  1072. endif
  1073. endif
  1074. else
  1075. if ?ff+???+?po+?rp
  1076. if (?TF eq 0) or (???+?rp)
  1077.     mov    sp,bp
  1078. endif
  1079.     pop    bp
  1080. endif
  1081. endif
  1082. ife cc
  1083.     ret
  1084. else
  1085.     ret    o
  1086. endif
  1087. endif
  1088. endif
  1089. n endp
  1090. .cref
  1091. purge cEnd
  1092. &endm
  1093. .cref
  1094. endm
  1095. assumes macro s,ln
  1096. ifndef ln&_assumes
  1097. assume s:ln
  1098. else
  1099. ln&_assumes s
  1100. endif
  1101. endm
  1102. createSeg macro n,ln,a,co,cl,grp
  1103. ifnb <grp>
  1104. addseg grp,n
  1105. else
  1106. ln&OFFSET equ offset n:
  1107. ln&BASE equ n
  1108. ?cs3 <ln>,<n>
  1109. endif
  1110. ifnb <cl>
  1111. n segment a co '&cl'
  1112. else
  1113. n segment a co
  1114. endif
  1115. n ends
  1116. ?cs1 <ln>,<n>
  1117. endm
  1118. addseg macro grp,seg
  1119. .xcref
  1120. .xcref grp&_def
  1121. .cref
  1122. ifndef grp&_def
  1123. grp&_def=0
  1124. endif
  1125. if grp&_def ne ASMpass
  1126. .xcref
  1127. .xcref grp&_add
  1128. .cref
  1129. grp&_add ¯o s
  1130. grp&_in <seg>,s
  1131. &endm
  1132. .xcref
  1133. .xcref grp&_in
  1134. .cref
  1135. grp&_in ¯o sl,s
  1136. ifb <s>
  1137. grp group sl
  1138. else
  1139. grp&_add ¯o ns
  1140. grp&_in <sl,s>,ns
  1141. &endm
  1142. endif
  1143. &endm
  1144. grp&_def=ASMpass
  1145. else
  1146. grp&_add seg
  1147. endif
  1148. endm
  1149. defgrp macro grp,ln
  1150. addseg grp
  1151. ifnb <ln>
  1152. irp x,<ln>
  1153. ?cs3 <&x>,<grp>
  1154. x&&OFFSET equ offset grp:
  1155. x&&BASE equ grp
  1156. endm
  1157. endif
  1158. endm
  1159. ?cs1 macro ln,n
  1160. .xcref
  1161. .xcref ln&_sbegin
  1162. .cref
  1163. ln&_sbegin ¯o
  1164. .xcref
  1165. .xcref ?mf
  1166. .cref
  1167. ?mf &¯o c,l,p
  1168. if c
  1169.     extrn    n&_FARFRAME:near
  1170.     call    n&_FARFRAME
  1171. else
  1172.     extrn    n&_NEARFRAME:near
  1173.     call    n&_NEARFRAME
  1174. endif
  1175.     db    l shr 1
  1176.     db    p shr 1
  1177. &&endm
  1178. ?cs2 <ln>,<n>
  1179. n segment
  1180. &endm
  1181. endm
  1182. ?cs2 macro ln,n
  1183. .xcref
  1184. .xcref sEnd
  1185. .cref
  1186. sEnd ¯o
  1187. n ends
  1188. purge ?mf
  1189. purge sEnd
  1190. &endm
  1191. endm
  1192. ?cs3 macro ln,n
  1193. .xcref
  1194. .xcref ln&_assumes
  1195. .cref
  1196. ln&_assumes ¯o s
  1197. assume s:&n
  1198. &endm
  1199. endm
  1200. .xcref
  1201. .xcref sBegin
  1202. .cref
  1203. sBegin macro ln
  1204. ln&_sbegin
  1205. endm
  1206. ife ?DF
  1207. createSeg _TEXT,Code,word,public,CODE
  1208. ife ?nodata1
  1209. createSeg _DATA,Data,word,public,DATA,DGROUP
  1210. defgrp DGROUP,Data
  1211. endif
  1212. if ?chkstk1
  1213. ifndef ?CHKSTKPROC
  1214. externp <chkstk>
  1215. endif
  1216. endif
  1217. endif
  1218. errnz macro x
  1219. if2
  1220. if x
  1221. errnz1 <x>,%(x)
  1222. endif
  1223. endif
  1224. endm
  1225. errnz1 macro x1,x2
  1226. = *errnz* x1 = x2
  1227. .err
  1228. endm
  1229. errn$ macro l,x
  1230. errnz <offset $ - offset l x>
  1231. endm
  1232. ifdef ?PROFILE
  1233. externFP <StartNMeas,StopNMeas>
  1234. endif
  1235.